#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s1 = "", s2 = "";
	getline(cin, s1);
	getline(cin, s2);
	
	for(auto &i:s1)
		if('a' <= i && i <= 'z')
			i -= 'a'-'A';
	
	for(auto &i:s2)
		if('a' <= i && i <= 'z')
			i -= 'a'-'A';
	
	string t1, t2;
	for(auto i:s1)
		if(i != ' ')
			t1 += i;
	for(auto i:s2)
		if(i != ' ')
			t2 += i;
	if(t1 == t2)
		cout<<"YES";
	else
		cout<<"NO";
	return 0;
}

